//
//  YDInquiryResultController.m
//  PeiZiWangBei
//
//  Created by LK-IOS on 2018/3/2.
//  Copyright © 2018年 LK-IOS. All rights reserved.
//

#import "YDInquiryResultController.h"
#import "YDInquiryResultCell.h"
#import "YDInquiryResultReferenceView.h"

#import "YDRechargeController.h"
#import "YDOneRechargeViewController.h"
#import "YDBindBankCardController.h"
#import "YDPaymentPasswordController.h"
#import "YDPayAlertView.h"

#import "YDRealNameAuthController.h"

@interface YDInquiryResultController ()<UITableViewDelegate , UITableViewDataSource , SYInquiryResultReferenceViewDelegate>


@property (nonatomic , weak) UITableView *tableView;


@property (nonatomic , weak) YDInquiryResultReferenceView *referenceView;//询价结果参考View

@end

@implementation YDInquiryResultController

- (void)viewDidLoad
{
    [super viewDidLoad];
    self.automaticallyAdjustsScrollViewInsets = NO;
    self.title = @"确认订单";
    self.view.backgroundColor = [UIColor whiteColor];
    
    DDLog(@"%@" , self.buyDic)
    
    [self tableView];
    
    [self referenceView];
    
}
-(void)viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];
    
    
    [self loadUserBalance];
}
/*******tableView********/
-(UITableView *)tableView
{
    if (_tableView == nil) {
        CGFloat safeTopH = isPhoneX ? 88 : 64;
        UITableView *tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, LKScreenW, self.view.height - safeTopH) style:UITableViewStylePlain];
        [self.view addSubview:tableView];
        tableView.backgroundColor = [UIColor whiteColor];
        tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
        tableView.dataSource = self;
        tableView.delegate = self;
        tableView.estimatedRowHeight = 0;
        tableView.estimatedSectionFooterHeight = 0;
        tableView.estimatedSectionHeaderHeight = 0;
        if (isIos11) {
            tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
        }
        _tableView = tableView;
    }
    return _tableView;
}


/**********referenceView***********/
-(YDInquiryResultReferenceView *)referenceView
{
    if (_referenceView == nil) {
        NSString *rate = [NSString stringWithFormat:@"%@" , self.buyDic[@"rightMoneyRatio"]];
        NSString *nominalPrincipal = [[NSString stringWithFormat:@"%@" , self.buyDic[@"money"]] pz_stringNumberByMultiplyingBy:@"10000"];
        
        
        YDInquiryResultReferenceView *referenceView = [YDInquiryResultReferenceView initInquiryResultReferenceViewWithReferenceRate:rate NominalPrincipal:nominalPrincipal];
        CGRect referenceViewFrame;
        if (isPhoneX) {
            referenceViewFrame = CGRectMake(0, 0, LKScreenW, rateX812(300));
        }else{
            referenceViewFrame = CGRectMake(0, 0, LKScreenW, rate750(300));
        }
        referenceView.frame = referenceViewFrame;
        self.tableView.tableFooterView = referenceView;
        referenceView.delegate = self;
        _referenceView = referenceView;
        
    }
    return _referenceView;
}
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 7;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return isPhoneX ? rateX812(44) : rate750(44);
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    YDInquiryResultCell *cell = [YDInquiryResultCell cellWithTableView:tableView];
    
    if (indexPath.row != 5) {
        cell.questionImage.hidden = YES;
    }else{
        cell.questionImage.hidden = NO;
        [cell updateCellConstraints];
        
    }
    if (indexPath.row == 0) {
        cell.cateLabel.text = @"标的股票：";
        cell.contentLabel.text = [NSString stringWithFormat:@"%@(%@)" , self.buyDic[@"stockName"] , self.buyDic[@"stockCode"]];
    }else if (indexPath.row == 1){
        cell.cateLabel.text = @"策略金额：";
        NSString *benjin = [NSString countNumAndChangeformat:[@"10000" pz_stringNumberByMultiplyingBy:[NSString stringWithFormat:@"%@" , self.buyDic[@"money"]]]];
        cell.contentLabel.text = [NSString stringWithFormat:@"%@元" , benjin];
    }else if (indexPath.row == 2){
        cell.cateLabel.text = @"策略周期：";
        cell.contentLabel.text = [NSString stringWithFormat:@"%@" , self.buyDic[@"optionsTime"]];
    }else if (indexPath.row == 3){
        cell.cateLabel.text = @"买入方式：";
        cell.contentLabel.text = [NSString stringWithFormat:@"%@" , @"市价买入"];
    }else if (indexPath.row == 4){
        cell.cateLabel.text = @"策略倍数：";
        
        cell.contentLabel.attributedText = [self getMoneybackString];
    }else if (indexPath.row == 5){
        cell.cateLabel.text = @"策略风控服务费：";
        cell.contentLabel.textColor = [UIColor colorWithHexString:paleRed];
        cell.contentLabel.text = [NSString stringWithFormat:@"%@元", [self getRightPrincipal]];
    }else if (indexPath.row == 6){
        cell.cateLabel.text = @"账户余额：";
        cell.contentLabel.textColor = [UIColor colorWithHexString:paleRed];
        NSString *account = [[SYUserDataManger sharedInstance] getUserAccountNumberString];
        cell.contentLabel.text = [NSString stringWithFormat:@"%@元" , account];
    }
    
    
    LK(weakSelf)
    cell.questionClick = ^{
        
        PZTipsAlertView *alert = [PZTipsViewManger shareSingleTipsAlertViewTitle:@"策略风控服务费" Mesage:@"策略费用根据资金成本、平台服务费、策略风控服务费、交易手续费和税费等计算确定。其中，策略风控服务费由风控团队根据策略标的亏损风险确定；交易手续费和税费由证券公司、交易所按照法律法规及相关规定收取。" ButtonTitle:@"我知道了" ButtonClickBlock:^{
            
            [weakSelf.pz_popupController dismiss];
            
        }];
        weakSelf.pz_popupController = [[PZPopUpController alloc] init];
        [weakSelf.pz_popupController dropAnimatedWithRotateAngle:30];
        [weakSelf.pz_popupController presentContentView:alert duration:0.75 springAnimated:YES];
    };
    
    return cell;
}

//获取权利本金 = 询价比例 * 名义本金
-(NSString *)getRightPrincipal
{
    
    NSString *rate = [NSString stringWithFormat:@"%@" , self.buyDic[@"rightMoneyRatio"]];
    NSString *nominalPrincipal = [[NSString stringWithFormat:@"%@" , self.buyDic[@"money"]] pz_stringNumberByMultiplyingBy:@"10000"];
    
    
    if (([rate floatValue] <= 0 || !rate.length) || ([nominalPrincipal floatValue] <= 0 || !nominalPrincipal.length)) {
        return @"---";
    }else{
        return [NSString countNumAndChangeformat:[rate pz_stringNumberByMultiplyingBy:nominalPrincipal]];
    }
}
//投资回报
-(NSMutableAttributedString *)getMoneybackString
{
    
    NSString *string1 = [NSString stringWithFormat:@"%@", @"(90%盈利)"];
    
    //中划线
    NSDictionary *attribtDic = @{NSStrikethroughStyleAttributeName: [NSNumber numberWithInteger:NSUnderlineStyleSingle] , NSForegroundColorAttributeName:[UIColor colorWithHexString:blueyGrey] ,NSStrokeColorAttributeName :  [UIColor colorWithHexString:blueyGrey]};
    NSMutableAttributedString *attribtStr = [[NSMutableAttributedString alloc]initWithString:string1 attributes:attribtDic];
    
    NSString *string2 = [NSString stringWithFormat:@"%@", @"100%盈利"];
    NSDictionary *attribtDic1 = @{NSForegroundColorAttributeName:[UIColor colorWithHexString:dark]};
    
    NSMutableAttributedString *attribtStr1 = [[NSMutableAttributedString alloc]initWithString:string2 attributes:attribtDic1];
    
    [attribtStr appendAttributedString:[attribtStr1 copy]];
    
    return attribtStr;
    
    
    
}
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    return 0.f;
}
-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
{
    return isPhoneX ? rateX812(10) : rate750(10);
}
-(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
{
    UIView *view = [UIView new];
    view.backgroundColor = [UIColor colorWithHexString:mainGray];
    return view;
}




-(void)inquiryResultReferenceView:(YDInquiryResultReferenceView *)referenceView ClickStyle:(SYInquiryResultReferenceClickStyle)style
{
    if (style == ReferenceViewXuZhi) {//须知
        YDAgreementController *vc = [[YDAgreementController alloc] init];
        vc.agreementCategory = OptionRiskNotice;
        vc.hidesBottomBarWhenPushed = YES;
        [self.navigationController pushViewController:vc animated:YES];
    }else if (style == ReferenceViewHeZuo){//合作
        YDAgreementController *vc = [[YDAgreementController alloc] init];
        vc.agreementCategory = OptionCooperationAgreement;
        vc.hidesBottomBarWhenPushed = YES;
        [self.navigationController pushViewController:vc animated:YES];
        
    }else if (style == ReferenceViewRenGou){
        //        DDLog[(@"认购")
        //1 实名认证 2 余额不足 3 密码错误
        
        
        
        if ([SYUserDataManger sharedInstance].getUserTips) {
            [self authentication];
        }else{
            [self userTips];
        }
    }
}


/**
 风险提示
 */
-(void)userTips
{
    LK(weakSelf)
    PZTipsSureAlertView *alert = [[PZTipsSureAlertView alloc] initWithConstantWidth:LKScreenW - rate375(23) *2 Title:@"风险提示" message:@"权利金包括券商收取的权利金、平台服务费、税收等，一经交易，权利金将不予退回！" SelectedTip:@"下次不再提醒" ButtonTitle:@"我知道了" Explain:@"详情参见《用户须知及风险提示》" SelectedHandler:^(SYNoHeightedButton *button) {
        
        if (button.selected) {
            [[SYUserDataManger sharedInstance] storeUserTips:YES];
        }else{
            [[SYUserDataManger sharedInstance] storeUserTips:NO];
        }
        
    } OkeyHandler:^(SYNoHeightedButton *button) {
        [weakSelf.pz_popupController dismiss];
        
        [weakSelf authentication];
        
        
    } ExplainHandle:^{
        
        [weakSelf.pz_popupController dismiss];
        
        YDAgreementController *vc = [[YDAgreementController alloc] init];
        vc.agreementCategory = OptionRiskNotice;
        vc.hidesBottomBarWhenPushed = YES;
        [weakSelf.navigationController pushViewController:vc animated:YES];
        
        
    }];
    
    weakSelf.pz_popupController = [[PZPopUpController alloc] init];
    [weakSelf.pz_popupController dropAnimatedWithRotateAngle:30];
    [weakSelf.pz_popupController presentContentView:alert duration:0.75 springAnimated:YES];
    
    
}



- (void)rengou
{
    LK(weakSelf)
    NSMutableDictionary *dict = [NSMutableDictionary dictionary];
    
    [dict setObject:@1 forKey:@"buyingType"]; //买入方式 市价买入
    [dict setObject:[self.buyDic objectForKey:@"cycleId"] forKey:@"cycleId"]; //期权周期
    [dict setObject:@([[self.buyDic objectForKey:@"money"] floatValue] * 10000) forKey:@"nominalAmount"];//买入资金
    [dict setObject:[self.buyDic objectForKey:@"stockCode"] forKey:@"stockCode"];//股票代码
    
    
    DDLog(@"dict = %@" , dict)
    
    
    YDPayAlertView *payView = [[YDPayAlertView alloc] initWithFrame:CGRectMake(0, 0, LKScreenW, LKScreenH) inputFinish:^(NSString *passWord) {
        
        [dict setObject:passWord forKey:@"paymentPassword"];
        [[SYProgressHUD sharedInstance] showMBHudWithSting:kLoadingText];
        
        [BaseNetRequest sessionRequestWithparameters:dict
                                                   method:POSTMethod
                                               requstType:OptionsTrade
                                         WithSuccessBlock:^(NSDictionary *resultDict) {
                                             [[SYProgressHUD sharedInstance] dismissMBWithTime:0];
                                             if ([resultDict[@"code"] integerValue] == 200)
                                                 
                                             {
                                            
                                                 [[SYUserDataManger sharedInstance] currentAccountBalanceChangeWithUsedAmountString:[[self getRightPrincipal] stringByReplacingOccurrencesOfString:@"," withString:@""] IsAdd:NO];
                                                 
                                                 [[NavTipsView defaultTipsView] showTipsBannerInView:self.view
                                                                                                 WithType:NavTipsViewTypeSuccess text:@"购买成功"
                                                                                               isExistNav:YES];
                                                 dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
                                                     
                                                     [weakSelf.navigationController popToRootViewControllerAnimated:NO];
                                                     
                                                     dispatch_async(dispatch_get_main_queue(), ^{
                                                         [[NSNotificationCenter defaultCenter] postNotificationName:kOptionsBuySuccessNoti object:nil];
                                                     });
                                                     
                                                 });
                                             }
                                             else if ([resultDict[@"code"] integerValue] == 6001)
                                             {
                                                 //账号余额不足
                                                 [weakSelf showAccountBalanceNotEnoughAlert];
                                                 
                                             }
                                             else if ([resultDict[@"code"] integerValue] == 6013)
                                             {
                                                 //非交易时间段
                                                 //                                                 [self noTransactionTimeAlert];
                                             }
                                             else
                                             {
                                                 
                                                 [[NavTipsView defaultTipsView] showTipsBannerInView:weakSelf.view
                                                                                                 WithType:NavTipsViewTypeMessage text:resultDict[@"message"]
                                                                                               isExistNav:YES];
                                             }
                                             
                                         } failBlock:^(NSError *error) {
                                             [[SYProgressHUD sharedInstance] dismissMBWithTime:0];
                                             
                                             if ([ErrorMessageManager showErrorMessageWithError:error vc:weakSelf]) {
                                                 
                                             }
                                             else
                                             {
                                                 [[NavTipsView defaultTipsView] showTipsBannerInView:weakSelf.view
                                                                                                 WithType:NavTipsViewTypeMessage
                                                                                                     text:@"信息加载出错！"
                                                                                               isExistNav:YES];
                                             }
                                         }];
    }];
    [payView show];
    
}




/**
 实名认证
 */
- (void)authentication
{
    LK(weakSelf)
    [[SYProgressHUD sharedInstance] showMBHudOnlyLoading];
    [BaseNetRequest sessionRequestWithparameters:nil method:GETMethod requstType:GetSettingInformationList WithSuccessBlock:^(NSDictionary *resultDict) {
        

        DDLog(@"resultDict = %@" , resultDict)
        if ([resultDict[@"code"] integerValue] == 200) {
            
            if (![resultDict[@"result"][@"settingRealName"] boolValue]) {
                //去实名认证
                [[SYProgressHUD sharedInstance] dismissMBWithTime:0];
                [weakSelf showAuthenticationAlert];
            }else{
                //验证一下金额信息
                [weakSelf getUserAccoutBalance];
            }
        }else{
            [[SYProgressHUD sharedInstance] dismissMBWithTime:0];
            [[NavTipsView defaultTipsView] showTipsBannerInView:self.view WithType:NavTipsViewTypeMessage text:resultDict[@"message"] isExistNav:NO];
        }
    } failBlock:^(NSError *error) {
        [[SYProgressHUD sharedInstance] dismissMBWithTime:0];
        
        [[NavTipsView defaultTipsView] showTipsBannerInView:self.view WithType:NavTipsViewTypeMessage text:@"网络异常" isExistNav:NO];
    }];
}

/**
 获取用户金额信息
 */
-(void)getUserAccoutBalance
{
    LK(weakSelf)
    
    [BaseNetRequest sessionRequestWithparameters:nil method:GETMethod requstType:GetUerInfo WithSuccessBlock:^(NSDictionary *resultDict) {

        DDLog(@"resultDict = %@" , resultDict)

        
        if ([resultDict[@"code"] integerValue] == 200) {
            //成功刷新用户信息
            if (((NSDictionary *)resultDict[@"result"]).count) {
                
                [[SYUserDataManger sharedInstance] storeUserDataWithDict:resultDict[@"result"]];
                
                [weakSelf.tableView reloadData];
                
                //成功刷新用户信息
                NSString *accountString = [[NSString stringWithFormat:@"%@" , resultDict[@"result"][@"availableBalance"]] pz_stringNumberByMultiplyingBy:@"1"];
                
                [weakSelf judgeBalanceWithUserAccoutString:accountString];
                
            }



        }else{
            [[NavTipsView defaultTipsView] showTipsBannerInView:self.view WithType:NavTipsViewTypeMessage text:resultDict[@"message"] isExistNav:NO];
        }
    } failBlock:^(NSError *error) {
        //失败不做处理
        [[NavTipsView defaultTipsView] showTipsBannerInView:self.view WithType:NavTipsViewTypeMessage text:@"网络异常" isExistNav:NO];

    }];
}
/**
 比较金额够不够
 */
-(void)judgeBalanceWithUserAccoutString:(NSString *)accountString
{
    
    NSString *account = [accountString stringByReplacingOccurrencesOfString:@"," withString:@""];//从后台获取的用户账户余额
    NSString *right = [[self getRightPrincipal] stringByReplacingOccurrencesOfString:@"," withString:@""];//需要的权利金
    
    if ([right isEqualToString:@"---"]) {
        [[SYProgressHUD sharedInstance] dismissMBWithTime:0];
        [[NavTipsView defaultTipsView] showTipsBannerInView:self.view WithType:NavTipsViewTypeMessage text:@"权利金为空" isExistNav:YES];
        return;
        
    }
    
    if ([account doubleValue] < [right doubleValue]) {
        //余额不足
        [[SYProgressHUD sharedInstance] dismissMBWithTime:0];
        
        [self showAccountBalanceNotEnoughAlert];
    }else
    {
        [self payPassword];
    }
}
/**
 支付密码设置
 */
- (void)payPassword
{
    
    [BaseNetRequest sessionRequestWithparameters:nil method:GETMethod requstType:GetSettingInformationList WithSuccessBlock:^(NSDictionary *resultDict) {
        [[SYProgressHUD sharedInstance] dismissMBWithTime:0];
        if ([resultDict[@"code"] integerValue] == 200) {
            
            BOOL isBindCard = [resultDict[@"result"][@"settingPaymentPassword"] boolValue];
            if (isBindCard) {
                [self tradeDate];
                
            }else
            {
                
                [self goSetupPayPassword];
            }
        }else{
            
            
            [[NavTipsView defaultTipsView] showTipsBannerInView:self.view WithType:NavTipsViewTypeMessage text:@"信息加载出错，请重试~" isExistNav:YES];
        }
    } failBlock:^(NSError *error) {
        [[SYProgressHUD sharedInstance] dismissMBWithTime:0];
        [[NavTipsView defaultTipsView] showTipsBannerInView:self.view WithType:NavTipsViewTypeMessage text:@"信息加载出错，请重试~" isExistNav:YES];
    }];
}

/**
 请求交易时间
 */
- (void)tradeDate
{
    //交易时间
    [BaseNetRequest sessionRequestWithparameters:nil method:GETMethod requstType:GetSystemNewTime WithSuccessBlock:^(NSDictionary *resultDict) {
        
        if ([resultDict[@"code"] integerValue] == 200) {
            
            NSString *serveTime = resultDict[@"result"];
            if (serveTime.length) {
                NSString *sub = [[[serveTime componentsSeparatedByString:@" "] lastObject] stringByReplacingOccurrencesOfString:@":" withString:@""];
                
                if (sub.doubleValue > 143000) {
                    //超过下午14:30点提示
                    [self tradeDateAlert];
                }else
                {
                    [self rengou];
                }
            }
        }else{
            
            
            [[NavTipsView defaultTipsView] showTipsBannerInView:self.view WithType:NavTipsViewTypeMessage text:@"信息加载出错，请重试~" isExistNav:YES];
        }
    } failBlock:^(NSError *error) {
        [[SYProgressHUD sharedInstance] dismissMBWithTime:0];
        [[NavTipsView defaultTipsView] showTipsBannerInView:self.view WithType:NavTipsViewTypeMessage text:@"信息加载出错，请重试~" isExistNav:YES];
    }];
}

- (void)showAccountBalanceNotEnoughAlert
{
    //账户余额不足提示
    PZTipsAlertView *alert = [PZTipsViewManger shareSingleTipsAlertViewTitle:@"提示" Mesage:@"账户余额不足，请先充值！" ButtonTitle:@"去充值" ButtonClickBlock:^{
        
        [self.pz_popupController dismiss];
        [self.navigationController pushViewController:[[YDOneRechargeViewController alloc] init] animated:YES];
        
    }];
    self.pz_popupController = [[PZPopUpController alloc] init];
    [self.pz_popupController dropAnimatedWithRotateAngle:30];
    [self.pz_popupController presentContentView:alert duration:0.5 springAnimated:YES];
}

- (void)showAuthenticationAlert
{
    //实名认证弹窗
    PZTipsAlertView *alert = [PZTipsViewManger shareSingleTipsAlertViewTitle:@"提示" Mesage:@"您尚未进行实名验证，请先进行验证再申购" ButtonTitle:@"去验证" ButtonClickBlock:^{
        [self.pz_popupController dismiss];
        
        YDRealNameAuthController *vc = [[YDRealNameAuthController alloc] init];
        vc.hidesBottomBarWhenPushed = YES;
        [self.navigationController pushViewController:vc animated:YES];
        
        
    }];
    self.pz_popupController = [[PZPopUpController alloc] init];
    [self.pz_popupController dropAnimatedWithRotateAngle:30];
    [self.pz_popupController presentContentView:alert duration:0.75 springAnimated:YES];
}


-(void)goSetupPayPassword
{
    //设置支付密码弹窗
    PZTipsAlertView *alert = [PZTipsViewManger shareSingleTipsAlertViewTitle:@"提示" Mesage:@"您还没有设置支付密码，请先设置支付密码" ButtonTitle:@"去设置" ButtonClickBlock:^{
        
        
        [self.pz_popupController dismiss];
        YDPaymentPasswordController *vc = [[YDPaymentPasswordController alloc] init];
        vc.hidesBottomBarWhenPushed = YES;
        [self.navigationController pushViewController:vc animated:YES];
    }];
    self.pz_popupController = [[PZPopUpController alloc] init];
    [self.pz_popupController dropAnimatedWithRotateAngle:30];
    [self.pz_popupController presentContentView:alert duration:0.75 springAnimated:YES];
}
//

- (void)tradeDateAlert
{
    PZTipsAlertView *alert = [PZTipsViewManger shareDoubleTipsAlertViewTitle:@"提示" Mesage:@"现在是非交易时间，如果继续申购平台会在下一个交易日自动申购，买入价格会以实际成交价格为准，风险损失由用户自行承担，是否继续申购？" CancleTitle:@"取消" SureTitle:@"确定" CancleBlock:^{
        [self.pz_popupController dismiss];
        
    } SureBlock:^{
        [self.pz_popupController dismiss];
        [self rengou];
        
    }];
    
    self.pz_popupController = [[PZPopUpController alloc] init];
    [self.pz_popupController dropAnimatedWithRotateAngle:30];
    [self.pz_popupController presentContentView:alert duration:0.75 springAnimated:YES];
}

-(void)loadUserBalance
{
    [BaseNetRequest sessionRequestWithparameters:nil method:GETMethod requstType:GetUerInfo WithSuccessBlock:^(NSDictionary *resultDict) {
        
        DDLog(@"resultDict = %@" , resultDict)
        if ([resultDict[@"code"] integerValue] == 200) {
            //成功刷新用户信息
            if (((NSDictionary *)resultDict[@"result"]).count) {
                
                [[SYUserDataManger sharedInstance] storeUserDataWithDict:resultDict[@"result"]];
                
                [self.tableView reloadData];
                
            }
            
        }
    } failBlock:^(NSError *error) {

        
    }];
}
@end

